package com.heima.comment.controller;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.CommentDto;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentSaveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojo.ApUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/comment")
public class SaveCommentController {


    @Autowired
    private CommentService commentService;

    @PostMapping("/save")
    public ResponseResult saveComment(@RequestBody CommentSaveDto dto){

      return commentService.saveComment(dto);


    }


    @PostMapping("/load")
    public ResponseResult loadAll(@RequestBody CommentSaveDto dto){

        return commentService.loadAll(dto);

    }

    @PostMapping("/like")
    public ResponseResult likeComment(@RequestBody CommentLikeDto dto){

        return commentService.likeComment(dto);

    }

}
